<meta charset="utf-8">
<div style="width:100%" id='contratoView'>
    <?php
    foreach ($contratos as $row){
        
        $this->table->set_heading('ID','Contrato','Data de vigência','Arquivo','Ativa','Visualiza'//, 'Exclui'
        );
        if($row->ativo != 1){
            $acao = "contrato/ativa/$row->idcontrato";
        }
        else{
            $acao = "contrato/desativa/$row->idcontrato";
        }
        $ativo = $row->ativo != 0 ? $ativo = "<img src=".base_url()."img/icons/dislike_16x16.png>" 
                : "<img src=".base_url()."img/icons/like_16x16.png>";                
        $this->table->add_row($row->idcontrato, $row->descricao_contrato, date('d/m/Y',(strtotime($row->dtvigencia))), 
            $row->arquivo_contrato,                       
            anchor($acao,$ativo),
            anchor("contrato/visualizaContrato/$row->idcontrato","<img src=".base_url()."img/icons/eye-1_16x16.png>", array('id'=>'ver', 'value'=>$row->idcontrato))
            //anchor("contrato/exclui/$row->idcontrato","<img src=".base_url()."img/icons/delete_16x16.png>", array('id'=>'exclui', 'value'=>$row->idcontrato))
        ); 
    }
    $tmpl = array ( 'table_open'  => '<table class="display" id="tcontrato">' );
    $this->table->set_template($tmpl);
    echo $this->table->generate();
    ?>
</div>